home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / C64 / B-Business / (c)b2.d64 / word processor.c (.txt) < prev   
Commodore BASIC  |  2007-02-04  |  6KB  |  227 lines

  1. 6 DEFFNE(X)=FRE(0)-65536*(FRE(0)<0)
  2. 7 T7%=PEEK(213):Y1%=(T7%+2)/20:YT%=(T7%-21)/3+1
  3. 8 OPEN4,4,7:IFY1%=2ANDFNE(0)<31000THENY1%=3
  4. 10 IFY1%>2THENPRINT#4:CLOSE4:OPEN4,4
  5. 15 DK%=1
  6. 20 T1=79:MG=1:ET=INT(FNE(0)/60)
  7. 25 Y2%=4:Y3%=4:Y4%=17:CD$="":PK%=194
  8. 27 IFY1%>1THENCD$=CD$+"":Y2%=2:Y3%=10:Y4%=21:PK%=52
  9. 30 LL=1:G$=CHR$(34):SH$=CHR$(160):DIMT$(ET),TR$(20)
  10. 45 DEFFNA(X)=W3+(Z6-1)/Y2%
  11. 50 S$=CHR$(32):FORI=1TO15:SQ$=SQ$+S$:NEXT:SP$=LEFT$(SQ$,5)
  12. 70 GOTO100
  13. 85 PRINTTAB(YT%)"**[196]ISK ERROR**":GOTO95
  14. 90 PRINTTAB(YT%)"*[206]O FILE IN MEMORY*"
  15. 95 GOSUB18000
  16. 100 :
  17. 105 IFY1%<3THENPOKE788,PK%:PRINT"";:GOTO110
  18. 107 POKE144,88:POKE59468,14
  19. 110 PRINT"[147]"TAB(YT%)"**[207]PERATIONS**":PRINTTAB(YT%)"--------------"
  20. 150 PRINTTAB(YT%)"[215][146]RITE":PRINTTAB(YT%)"[197][146]DIT TEXT"
  21. 195 PRINTTAB(YT%)"[196][146]ISPLAY TEXT":PRINTTAB(YT%)"[193][146]DDRESS LETTER"
  22. 200 PRINTTAB(YT%)"[208][146]RINT TEXT"
  23. 220 PRINTTAB(YT%)"[198][146]ILE COMMANDS":PRINTTAB(YT%)"[211][146]ET FORMAT":
  24. 225 PRINTTAB(YT%)"[209][146]UIT":PRINTTAB(YT%)"[195][210][211][210]^[146] [212].[207].[198]."
  25. 230 AC=0:RW=0:FORI=1TO2:NEXTI:FORJ=1TO2:NEXTJ
  26. 240 PRINTTAB(YT%+6)"[215]AIT":GOSUB19000:CLOSE2
  27. 300 PRINTTAB(YT%-1)"[145]";INT(FNE(0)/(T1-5))"LINES FREE"
  28. 400 PRINTTAB(YT%)"[212]OP LINE:"HI
  29. 500 GOSUB18010
  30. 520 IFA$="[145]"THENPRINT#4:GOTO500
  31. 530 FORI=1TO9:IFA$=MID$("WED[196]APFSQ",I,1)THEN570
  32. 540 NEXTI:GOTO500
  33. 570 PRINT"[147]":ONIGOTO1000,5500,6000,6000,600,12000,4000,21000,8000
  34. 580 GOTO100
  35. 600 FORI=1TO5:PRINT"[147][193]DDRESSEE'S NAME":PRINT"[193]DDRESS":PRINT"[195]ITY"
  36. 669 PRINT"[211]TATE + [218]IP":PRINT"[212]ODAY'S DATE"
  37. 673 FORJ=1TO5:PRINTLEFT$(CD$,J*4);"  "C$(J);:IFC$(J)=""THENPRINTSH$
  38. 675 NEXTJ
  39. 678 PRINTLEFT$(CD$,I*4);:INPUTC$(I):IFC$(I)=SH$THENC$(I)=""
  40. 680 NEXTI
  41. 684 PRINT"OK? (Y/N)":GOSUB18000:IFA$="N"THEN600
  42. 690 GOTO100
  43. 1000 PRINT"[215]RITE":PRINT"[210][197][212][213][210][206][146] NEW PARAGRAPH"
  44. 1005 IFHI>0THENPRINTHI;T$(HI)""
  45. 1030 GOSUB10000:IFL<2ORLL=>ETTHEN100
  46. 1040 T$(LL)=L$:PRINT:LL=LL+1
  47. 1060 GOTO1030
  48. 3000 IFCX>CYTHENCZ=CX:CX=CY:CY=CZ
  49. 3010 CZ=CY-CX+1
  50. 3020 GOSUB19000
  51. 3030 FORI=CXTOHI-CZ
  52. 3040 T$(I)=T$(I+CZ)
  53. 3050 NEXTI:T$(I)="[138]":CX=0:J=I+1
  54. 3055 FORI=JTOJ+CZ+2:T$(I)="":NEXTI
  55. 3060 GOSUB19000:GOTO5745
  56. 4000 PRINT"[204][146]OAD","[211][146]AVE":PRINT" <SH[146]>-[211]POOL FILE"
  57. 4017 PRINT"[208][146]URGE","[195][146]ATALOG"
  58. 4020 GOSUB18000:M$=A$
  59. 4022 FK$="@W/":IFM$="[204]"ORM$="[211]"THENFK$="@S/":GOTO4040
  60. 4025 IFM$="C"THEN49000
  61. 4030 IFM$="P"THEN4970
  62. 4035 IFM$<>"S"ANDM$<>"L"THEN100
  63. 4040 IF(M$="S"ORM$="[211]")ANDHI=0THEN90
  64. 4050 PRINT"[212][146]APE","[196][146]ISK":GOSUB18000
  65. 4060 J=1:IFM$="L"THENINPUT"[211]TARTING ADDRESS  1[157][157][157]";J
  66. 4070 IFA$="D"THEN4600
  67. 4080 IFA$<>"T"THEN100
  68. 4170 IFM$="S"ORM$="[211]"THENAC=1
  69. 4200 PRINT"[212]APE READY?":GOSUB18000
  70. 4210 IFY1%>2THENPOKE144,85
  71. 4220 OPEN2,1,AC:GOTO4650
  72. 4600 IFDK%<>1THEN85
  73. 4610 PRINT"[198]ILENAME?":INPUT"  MISC[157][157][157][157][157][157]";FL$
  74. 4625 FM$=",S,W":IFM$="L"ORM$="[204]"THENFM$=",S,R"
  75. 4630 FL$=FK$+FL$+FM$
  76. 4640 OPEN2,8,2,FL$:GOSUB20000:IFE1<>0THEN85
  77. 4645 IFM$="[211]"THENRW=2:GOTO12010
  78. 4650 IFM$="L"ORM$="[204]"THEN4800
  79. 4660 FORI=1TOHI:PRINT#2,G$+T$(I)+G$
  80. 4664 PRINT"*";:NEXTI:GOTO100
  81. 4800 FORI=JTOET:INPUT#2,T$(I):IF(ST)AND64THEN100
  82. 4900 PRINT"*";:NEXTI:GOTO85
  83. 4970 PRINT"[193]RE YOU SURE? (Y/N)":GOSUB18000:IFA$<>"Y"THENPRINT"[193]BORTED":GOTO95
  84. 4980 FORI=1TOET:T$(I)="":NEXT:FORI=1TO4:C$(I)="":NEXT:GOTO90
  85. 5000 GOSUB19000:LG=FNA(0):AC=0
  86. 5010 PRINT"[147]"LG"[157]>";T$(LG)
  87. 5020 FORLB=1TO20:PRINT:PRINT:GOSUB10000:IFL<2ORHI+LB>ET-2THEN5200
  88. 5050 TR$(LB)=L$:NEXTLB
  89. 5200 LB=LB-1:IFLB=0THEN5745
  90. 5250 FORI=HI+LBTOLG+1+LBSTEP-1:T$(I)=T$(I-LB):NEXTI:J=0
  91. 5275 FORI=LG+1TOLG+LB:J=J+1:T$(I)=TR$(J):TR$(J)="":NEXTI:GOSUB19000:GOTO5745
  92. 5500 IFHI=0THEN90
  93. 5505 CX=0:INPUT"LINE #  1[157][157][157]";W3:Z6=1:Z5=1:JG$=""
  94. 5745 IFW3>HI-Y3%THENW3=HI-Y3%
  95. 5747 IFW3<1THENW3=1
  96. 5750 Z4=1:PRINT"[147]":FORI=W3TOW3+Y3%
  97. 5775 PRINTLEFT$(CD$,Z4);I"[157]";TAB(4)CHR$(34);T$(I);CHR$(34):Z4=Z4+Y2%
  98. 5800 NEXTI
  99. 5803 PRINTLEFT$(CD$,22);:IFY1%>1THENPRINT:PRINT
  100. 5805 PRINT"[195][210][211][210]>[146][197]DIT _[146][211]WAP [196][146]ELETE";:IFY1%>1THENPRINT
  101. 5807 PRINT"[201][146]NSERT [195][210][211][210][146]UP, DOWN";
  102. 5915 IFZ6<1THENZ6=1:W3=W3-1:GOTO5745
  103. 5925 IFZ6>Y4%THENZ6=Y4%:W3=W3+1:GOTO5745
  104. 5950 PRINTLEFT$(CD$,Z5)" [157] ";
  105. 5952 PRINTLEFT$(CD$,Z6)">[146]";:Z5=Z6
  106. 5955 GOSUB18000
  107. 5962 IFA$=""THENZ6=Z6+Y2%:GOTO5915
  108. 5965 IFA$=""THENPRINTTAB(2);:JG$=T$(FNA(0)):INPUTT$(FNA(0)):GOTO5745
  109. 5970 IFA$="[145]"THENZ6=Z6-Y2%:GOTO5915
  110. 5972 IFA$="D"ANDCX<>0THENCY=FNA(0):GOTO3000
  111. 5974 IFA$="D"THENCX=FNA(0)
  112. 5975 IFA$="I"THEN5000
  113. 5980 IFA$="_"ANDJG$<>""THENJH$=T$(FNA(0)):T$(FNA(0))=JG$:JG$=JH$:GOTO5745
  114. 5985 IFASC(A$)=13THEN100
  115. 5990 GOTO5955
  116. 6000 IFHI=0THEN90
  117. 6010 GOSUB17000
  118. 6020 TU=T1:T1=T7%:RW=1:IFI=4THENAC=1
  119. 6030 GOTO12010
  120. 6100 T1=TU:IFA$=""THEN100
  121. 6110 GOTO95
  122. 8000 PRINT"[147] ARE YOU SURE? (Y/N)"
  123. 8010 GET S$:IFS$=""THEN8010
  124. 8020 IF S$<>"Y"THEN100
  125. 8030 IF Y1%>2THENPOKE144,85
  126. 8040 NEW:END
  127. 10000 L$=""
  128. 10015 IFAC=13ORLL=1THENL$="_"
  129. 10020 PRINT"[164][157]";:L=LEN(L$)
  130. 10030 GOSUB18010:IFA$=""THENA$=SP$
  131. 10032 IFA$=SH$THENA$=S$
  132. 10035 AC=ASC(A$)
  133. 10040 IF(L>57ANDAC=32)ORL>72ORAC=13THENPRINTS$;:RETURN
  134. 10045 IF(AC=20ORAC=148)ANDL>1THENPRINT"";:L$=LEFT$(L$,L-1):GOTO10020
  135. 10050 IFAC=34THEN10020
  136. 10060 IF(AC>31ANDAC<96)OR(AC>192ANDAC<219)THENL$=L$+A$:PRINTA$;
  137. 10080 GOTO10020
  138. 11000 FORI=1TOHI:Y7$=T$(I):GOSUB13000:IFA$=""THENAC=1:PRINT"[193]BORTING"
  139. 11200 NEXTI:IFPG<>0THENFORPG=PG+1TO57:PRINT#4:NEXT:GOSUB13000
  140. 11210 IFAC=1THEN100
  141. 11220 PD=0:GOTO11000
  142. 12000 IFHI=0THEN90
  143. 12001 PRINT" [208][210][201][206][212]":PRINT"[206][146]EW DOCUMENT"
  144. 12002 PRINT"[195][146]ONTINUE OLD DOCUMENT":PRINT"[211][146]POOL FILE"
  145. 12003 RW=0:GOSUB18000:M$=A$:IFM$="C"THENGOSUB17000:GOTO12020
  146. 12004 IFM$<>"N"ANDM$<>"S"THEN100
  147. 12005 PG=0:PD=0:PRINT" [211]ET TO TOP-OF-FORM..  [210]EADY?"
  148. 12006 GOSUB18010:IFA$="[145]"THENPRINT#4:GOTO12006
  149. 12009 GOSUB17000:IFM$="S"THENRW=3:GOTO11000
  150. 12010 IFC$(1)=""THEN12020
  151. 12015 FORI=1TO7:Y7$=C$(I):IFI=3THENY7$=Y7$+","
  152. 12018 GOSUB13000:NEXT
  153. 12020 TL=HI:PH=0:I=1:T$=""
  154. 12030 IFLEN(T$)+LEN(T$(I)+S$)>245THEN12100
  155. 12040 IF(LEFT$(T$(I),1)="_"ANDI<>1)ORI>TLTHENPH=1:GOTO12100
  156. 12050 T$=T$+T$(I)+S$:I=I+1
  157. 12060 GOTO12030
  158. 12100 IFLEFT$(T$,1)="_"THENT$=SP$+MID$(T$,2)
  159. 12110 FORJ=T1TO1STEP-1
  160. 12120 IFMID$(T$,J,1)=S$THENT1$=LEFT$(T$,J-1):T$=MID$(T$,J+1):GOTO12200
  161. 12130 NEXTJ:T1$=LEFT$(T$,T1-1):T$=MID$(T$,T1)
  162. 12200 IFMG=1AND(RW<>1ORAC=1)THENGOSUB14000
  163. 12220 Y7$=T1$:GOSUB13000:T1$=""
  164. 12225 IFDT=1THENGOSUB13000
  165. 12227 IFA$=""THEN12300
  166. 12230 IFLEN(T$)>T1THEN12110
  167. 12240 IFPH=1ANDT$=""THEN12245
  168. 12242 GOTO12250
  169. 12245 PH=0:IFDT=0THENGOSUB13000
  170. 12247 IFI=<TLTHEN12050
  171. 12250 IFPH=1THEN12110
  172. 12260 IFI>TLTHEN12300
  173. 12270 GOTO12030
  174. 12300 ONRWGOTO6100,100
  175. 12310 PRINT"[212]OP-OF-FORM? ([217]/[206])":GOSUB18000:IFA$<>"Y"THEN100
  176. 12320 IFPG=0THEN100
  177. 12330 GOSUB13000:GOTO12320
  178. 13000 IFRW=2THEN13800
  179. 13005 GETA$:IFA$=""THENGOSUB18010
  180. 13010 IFRW=3THEN13050
  181. 13015 IFRW=1THENPRINTY7$:Y7$="":RETURN
  182. 13020 Y7$=LEFT$(SQ$,SP)+Y7$
  183. 13050 PRINT#4,Y7$:Y7$=""
  184. 13100 PG=PG+1:IFPG<58THENRETURN
  185. 13125 PD=PD+1:PD$="("+MID$(STR$(PD),2)+")"
  186. 13150 PRINT#4:PRINT#4,""TAB(65)PD$
  187. 13200 FORJ=1TO6:PRINT#4:NEXTJ:PG=0
  188. 13700 RETURN
  189. 13800 Y7$=LEFT$(SQ$,SP)+Y7$:IFY7$=""THENY7$=S$
  190. 13900 PRINT#2,G$+Y7$+G$:Y7$="":RETURN
  191. 14000 J5=1:T8=T1-LEN(T1$):J=1:MD=0:IFT8>25THENT8=25
  192. 14050 MD$=MID$(T1$,J,1)
  193. 14075 IFMD$<>S$THENMD=1
  194. 14085 IFMD$=S$ANDMD=0THEN14200
  195. 14150 IFMD$=S$THENT1$=LEFT$(T1$,J)+MID$(T1$,J):J=J+1:J5=J5+1:IFJ5>T8THENRETURN
  196. 14200 J=J+1:IFJ>LEN(T1$)THENRETURN
  197. 14225 GOTO14050
  198. 17000 PRINT"[195][210][211][210]>[146] [208]AUSE":PRINT"[195][210][211][210]V[146] [193]BORT"
  199. 17100 PRINT"-----------------":RETURN
  200. 18000 FORIK=1TO10:GETA$:NEXTIK
  201. 18010 GETA$:IFA$=""THEN18010
  202. 18020 RETURN
  203. 19000 FORI=1TOET-2:IFT$(I)="[138]"THEN19020
  204. 19007 IFT$(I)=""THENIFT$(I+1)=""ANDT$(I+2)=""THENT$(I)="[138]":GOTO19020
  205. 19010 NEXTI
  206. 19020 HI=I-1:LL=I:RETURN
  207. 20000 IFEE=0THENEE=15:OPENEE,8,EE
  208. 20010 INPUT#EE,E1,E2$,E3,E4
  209. 20020 IFE1=0THENRETURN
  210. 20030 PRINTE1;E2$;E3;E4:RETURN
  211. 21000 PRINT"[147]"CD$TAB(YT%)"* [196]EFAULT";
  212. 21020 PRINT"[205]ARGINS:"
  213. 21022 PRINT"*[206][146]ONE"
  214. 21025 PRINT" [211][146]MALL","(1/2 INCH)"
  215. 21030 PRINT" [204][146]ARGE","(1.5 INCH)":GOSUB18000:T1=79:SP=0
  216. 21060 IFA$="S"THENT1=72:SP=4
  217. 21075 IFA$="L"THENT1=63:SP=8
  218. 21100 PRINT"[210]IGHT-JUSTIFICATION?  (*[217]/[206])":MG=1
  219. 21120 GOSUB18000:IFA$="N"THENMG=0
  220. 21200 PRINT"[196]OUBLE SPACE?":PRINT" [217][146]ES":PRINT" [206][146]O":DT=0
  221. 21220 PRINT"*[194][146]ETWEEN PARAGRAPHS":GOSUB18000:IFA$="Y"THENDT=1
  222. 21230 IFA$="N"THENDT=2
  223. 21250 IFY1%>2THEN100
  224. 21300 PRINT"[210]EPEATING KEYS? ([217]/*[206])":GOSUB18000
  225. 21350 POKE650,0:IFA$="Y"THENPOKE650,128
  226. 21500 GOTO100
  227.